home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
lib232.zip
/
SALT.DOC
< prev
next >
Wrap
Text File
|
1990-10-14
|
28KB
|
582 lines
SALT.DOC Copyright (C) 1990 Liberation Enterprises.
An introduction to Telix's script language.
This is not a comprehensive SALT tutor, and if you are seeking such you
won't find it here (a more extensive tutor will most likely be released
in the future). If you understand the logon scripts provided with
Telix, then you will probably be wasting your time reading this. This
document was designed for beginners, and simply explains some basics of
SALT, for Telix v3, and some easy-to-use but useful functions.
Everything is explained in simple terms, to enable non-programmers or
new Telix users to write usable scripts. You will also be shown how to
make use of the SALT manual.
Learning SALT is usually the only major obstacle people run into with
Telix. As I'm sure you are aware, SALT is one of, if not the most
powerful 'script' language available for any communications program.
Unfortunately, extra power usually translates into a more involved
learning process--the more power (or features) you have, the more there
is to learn. However, you need not learn the entire language and study
the entire SALT manual to create useful scripts. There are a few SALT
statements and functions listed below, that will enable you to automate
fairly complex tasks, without getting into any major programming. The
functions are:
capture(); Open, close, or pause a capture file. Specify the name
of the capture file between double quotes (e.g.
capture("TELIX.CAP"). If you don't specify a path,
Telix creates the file in the same directory as
TELIX.EXE. See CAPCMD.SLT for example usage of
capture().
cputs(); Put a 'string' of text out the communications port
(cputs is 'c' for communications port (modem), 'put'
for... put, 's' for string. A string is just a bunch of
characters grouped together between double quotes; a
sentence (e.g. "This is a string").
delay_scr(); Pause the script from running for a certain amount of
time. This is similar to delay(), but it allows the
screen to be updated with incoming characters for the
duration of the delay. Delays can be used to wait for a
prompt, etc.
dos(); Gives you access to DOS from within a Telix script.
'Access to DOS' means you can carry out a simple DOS
command, such as COPY, DEL, etc., or you can even run
another program if necessary. The command must be
placed between double quotes. Examples:
dos("DEL TEST.FIL"); ...or... dos("123.EXE");
goto <label> A script or program normally runs from top to bottom, or
from the first statement to the last. To change this,
and skip immediately to another section of the script,
you use 'goto's.
hangup(); Breaks the connection by hanging up.
return(); End the current 'function' right where we are, and
return to the 'caller'. The 'caller' depends on where
the return() is found. If you return() from the main()
The L i b e r a t o r v2.32 SALT.DOC - Page 2
function that all scripts start at, then you return to
the calling script (The Liberator, etc.) or to Telix
terminal mode. The Liberator tests any value you
return() from your script's main() function.
waitfor(); Wait for some text to come in from the BBS, or until a
specified number of seconds elapses. Combined with
cputs(), this is a very useful function and can automate
many tasks.
Two other useful functions are:
send(); Send a file to the BBS (upload)
receive(); Receive a file from the BBS (download)
You can write many useful scripts using just these functions. However,
your scripts wouldn't be capable of making any intelligent decisions
using just the above... For example, waitfor() allows you to wait for a
specified number of seconds for a certain message or prompt to come in
from the BBS; but what if the message doesn't come in? You don't want
to answer a question if the question hasn't even been asked, so you
must have some way to test whether the text came in or not. This is
where these two statements come into play:
if() Tests whether something is TRUE (successful) or FALSE
(unsuccessful).
while() Does something 'while' a certain condition is TRUE.
What's all this about TRUE and FALSE? How do these things 'test'
whether something is successful (TRUE) or unsuccessful (FALSE)? There
is just a simple rule that they follow, which says that: "TRUE is
anything that is not zero". The number 1 is TRUE, since it is not
zero, the letter 'A' must be TRUE since it is not zero... 1 + 1 (one
plus one) is TRUE, since it's end result is not zero, etc. "FALSE is
anything that does end up to be zero"... 0 itself is FALSE, 1 - 1 (one
minus one) is FALSE since its end result is zero.
This doesn't have to make sense... (and it certainly didn't for me at
first) that's just the way it is. Anything that results in a zero
value is considered FALSE, anything that results in a non-zero value is
considered TRUE. If something is FALSE, it is also known as unsuccess-
ful, or 'not' successful. 'Not' is used in SALT to refer to something
that is not TRUE: if it's "not TRUE", it must be FALSE, or zero. I'm
attempting to burn this into your memory since it is used all over the
place in SALT and is important to pick up. The true/false rule makes
scripts 'smart' enough to carry out meaningful decisions. Almost
everything in SALT evaluates to TRUE or FALSE and can be tested with
if() and while(). Just using TRUE and FALSE was enough to create The
Liberator, and many of the other programs you use.
If I had some money, how much do I have? I have TRUE amount of money
(it must be TRUE since it isn't zero...). To test the value in SALT, I
could use:
if (money)
The L i b e r a t o r v2.32 SALT.DOC - Page 3
...which is the same as saying "if money is TRUE"... Of course, it
wouldn't do much good just to know this unless I was going to do
something with the information, like this:
if (money)
spend();
This is how if() operates. 'If' whatever is between the brackets ends
up to be TRUE (not zero), then the next statement (up to the first
semicolon) is carried out: spend(); in this case. Then we move happily
along (by the way, scripts execute from top to bottom, unless told
otherwise). If whatever is between if()'s brackets evaluates to FALSE
('money' would be FALSE if it was equal to zero) then the statement
immediately following the if() is *skipped*. [Don't try to compile
these examples... they're just nonsense used for demonstration. Some
usable examples are given later.]
if (this_is_TRUE)
then_do_this();
The next line following an if() or while() is normally indented to show
that it may not get executed if the result is FALSE, and depends on the
if(). [Note that the SALT compiler doesn't care whether you indent or
not... in fact you could place an entire SALT script all on one line an
it will compile just fine. Indending, and placing statements